package com.fy.common.enums;

import com.alibaba.fastjson.JSONObject;

import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.List;

/**
 * 计分规则选项
 */
public enum ScoringType
{
    CONTAIN("内容包含"),
    EQUAL("内容等于"),
    LESSTHAN("数字小于"),
    GRATERTHAN("数字大于"),
    NUMEQUAL("数字等于"),
    BETWEEN("数字介于"),;

    private String desc;

    ScoringType(String desc) {
        this.desc = desc;
    }

    public String getDesc() {
        return desc;
    }

    public static String getKey(String desc) {
        Field[] fields = ScoringType.class.getFields();
        for (int i = 0; i <fields.length ; i++) {
            if(ScoringType.valueOf(fields[i].getName()).getDesc().equals(desc)){
                return fields[i].getName();
            }
        }
        return null;
    }
}
